﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConferenceArranger.ConferenceComponent
{   
    /// <summary>
    /// Given a list of tracks from TrackProcessor
    /// </summary>

    class Conference
    {   
        List<Track> trackList;

        public Conference(List<Track> trackList)
        {
            this.trackList = trackList;
        }


        public string ToString()
        {
            string myString = "";
            for (int i = 0; i < trackList.Count; i++)
            {
                myString += "Track " + (i + 1) + ":" + "\r\n";
                myString += trackList[i].ToString() ;
                if (i < trackList.Count - 1)
                    myString += "\r\n";
            }

            return myString;
        }

        /// <summary>
        /// write the details to external file
        /// </summary>
        /// <param name="outputLocation"></param>
        public void WriteOutput(string outputLocation)
        {
            string result = ToString();
            if(result.Length >0)
                System.IO.File.WriteAllText(outputLocation, result);
            else System.IO.File.WriteAllText(outputLocation, " No invalid talk is given");
        }
    }
}
